// 查询数据库的数据，获取到input框
// 编辑 取出数据
localStorage.getItem('data');
localStorage.getItem('editData');

let data = localStorage.getItem('data');
let editData = localStorage.getItem('editData');

let dataone = JSON.parse(data);
let editDataone = JSON.parse(editData);
console.log(editDataone);

console.log(data);
console.log(editData);
console.log($('.planId').val(editDataone.plan_id))
$('.planId').val(editDataone.plan_id),
$('.planName').val(editDataone.plan_name),
$('.p_effDate').val(editDataone.p_effDate),
$('.p_expDate').val(editDataone.p_expDate),
$('.crePerson').val(editDataone.p_crePerson),
$('.creDate').val(editDataone.p_creDate),
$('.upDate').val(editDataone.p_update),
$('.creDate').val(editDataone.p_creDate)


$('.save_edit').click(()=>{
    $.ajax({
        url: '/xinchou/edittwo',
        method: 'post',
        data: {
            //  planId 方案ID
            //  p_effDate 生效时间
            //  planName 方案名称
            //  crePerson 创建人
            //  creDate 创建时间
            //  upDate 更新人
            plan_id:$('.planId').val(),
            plan_name:$('.planName').val(),
            p_effDate:$('.p_effDate').val(),
            p_expDate:$('.p_expDate').val(),
            p_crePerson:$('.crePerson').val(),
            p_creDate:$('.creDate').val(),
            p_update:$('.upDate').val(),
            p_creDate:$('.creDate').val()
        },
        success: (res) => {
            console.log(res);
            alert('添加成功');
        }
    })
});
// 重置
$('.reset').click(() => {
    location.href = '../../pages/xinChouFuLi1--QinRong/SheBaoGongJiJingFanAn.html'

})